import React from 'react'
import { Navigate } from 'react-router-dom';

const getToken = () => {
  const token = localStorage.getItem('token');
  console.log(token);
  return token;
}


function RouterAuth({ children }) {
  debugger
  const token = getToken();
  if (token) {
    return <>{children}</>
  } else {
    return <Navigate to='/login' />
  }
}


export default RouterAuth;